<?php

	// +----------------------------------------------------------------------
	// | 用户消息
	// +----------------------------------------------------------------------
	// | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
	// +----------------------------------------------------------------------
	// | Author: 微尘 <yicmf@qq.com>
	// +----------------------------------------------------------------------

	namespace app\model\ucenter;

	class Message extends Common
	{

		public function user()
		{
			return $this->belongsTo(User::class);
		}

		public function fromUser()
		{
			return $this->belongsTo(User::class, 'from_user_id');
		}

		/**
		 * 写入修改
		 * @param $data
		 */
		public static function onBeforeInsert($data)
		{
			$data['status'] = 1;
			$data['is_read'] = 0;
			$data['ip'] = request()->ip();
		}
        protected $type = [
            'data' => 'array',
        ];

    }
